feat(assets-controller): add snaps migration FF#9534
Open
Kriys94 wants to merge 1 commit into
Open
Conversation
Kriys94
force-pushed
the
feat/wpn-1489-stage-gated-ingestion-migration-networks
branch
7 times, most recently
from
July 17, 2026 08:49
34d00a8 to
2f2753c
Compare
Kriys94
force-pushed
the
feat/wpn-1489-stage-gated-ingestion-migration-networks
branch
from
July 17, 2026 09:12
2f2753c to
355b70c
Compare
Kriys94
marked this pull request as ready for review
July 17, 2026 09:37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation
The
AssetsControllerneeds to take over assets ingestion (balances, metadata,prices) for the non-EVM networks currently owned by their Snaps — Solana,
Stellar, and Tron — but this has to happen gradually and be reversible per
network. Previously the
AssetsController/AccountsApiDataSourcehad no notionof a per-network migration state: the Accounts API data source hardcoded an
eip155-only filter for the chains it surfaced as active, so there was no safeway to stage the rollout or roll it back without a code change.
This PR adds stage-gated ingestion driven by the
RemoteFeatureFlagController, so the migration for each network can be advancedand rolled back independently via LaunchDarkly:
snaps-assets-migrationutil module defines the per-network rolloutmodel: the
SnapsAssetsMigrationStageenum (Off→ReadAssetsControllerWithFallback→
ReadAssetsControllerWithoutFallback→ReadAssetsControllerOnly), theper-network flag keys (
networkAssetsSnapsMigrationSolana,networkAssetsSnapsMigrationStellar,networkAssetsSnapsMigrationTron), andhelpers to resolve and evaluate a stage from remote feature flag state
(
parseSnapsAssetsMigrationStage,isMigrationStageActive,getSnapsAssetsMigrationNamespace,getMigrationStages,shouldSupportChain).AssetsControllerresolves each network's stage fromRemoteFeatureFlagControllerstate (read via theRemoteFeatureFlagController:getStatemessenger action). Migration networksare ingested (Account Activity WebSocket + Accounts API) only from
ReadAssetsControllerWithFallbackonward and left to the Snap when the stageis
Off— which is also the fail-safe when the flag is missing or thecontroller is unavailable. Non-migration namespaces (e.g.
eip155) are nevergated.
AccountsApiDataSourcenow gates the networks it surfaces as activechains on the same per-network stage (replacing the hardcoded
eip155-onlyfilter). It also subscribes to
RemoteFeatureFlagController:stateChange(mirroring
core-backend'sAccountActivityService) so newly-enablednetworks are picked up — and disabled ones dropped — without waiting for the
periodic refresh. A selector reduces the flags to a primitive migration-stage
signature so the handler only fires when a stage actually changes.
References
Checklist
Note
Medium Risk
Changes which non-EVM chains Accounts API treats as active and can shift balance ingestion between Snaps and the controller at runtime via flags; hosts must allow the new messenger event on restricted messengers.
Overview
Introduces stage-gated rollout for moving Solana, Stellar, and Tron assets from Snaps into
AssetsController, driven by per-network remote feature flags instead of a hardcodedeip155-only active-chain list.A new
snaps-assets-migrationmodule definesSnapsAssetsMigrationStage(OffthroughReadAssetsControllerOnly), flag keys (networkAssetsSnapsMigrationSolana/Stellar/Tron), and helpers to parse flags and decide whether a chain should be active. These types and helpers are re-exported from the package entrypoint for clients.AccountsApiDataSourcereplaces theeip155:filter withshouldSupportChain: EVM chains stay always on; migration namespaces appear only when their stage is at leastReadAssetsControllerWithFallback(missing flags fail toOff). It subscribes toRemoteFeatureFlagController:stateChangewith a migration-stage signature selector and refreshes active chains when a stage changes, without waiting for the periodic poll.AssetsControllerwidens allowed messenger events to includeRemoteFeatureFlagController:stateChangeso the data source can subscribe.@metamask/remote-feature-flag-controlleris added as a direct dependency.Reviewed by Cursor Bugbot for commit 355b70c. Bugbot is set up for automated code reviews on this repo. Configure here.